
#include "Common.hpp"
#include "GameServer.hpp"

int main(void)
{
	std::string Cmd;
	GameServer * gameServer = GameServer::instance();

	try {

		if (!gameServer->init("T4.cfg"))
		{
			GameServer::kill();
			return (0);
		}

		do {

			gameServer->resetGame();

			std::cout << "Waiting For 2 Players To Join... \n";

			gameServer->waitForConnections(2);

			gameServer->startGame();

			std::cout << "Type \'reset\' To Reset The Game Server, \'exit\' To Close Server.\n";
			std::cin >> Cmd;

		} while (Cmd == "reset");
	}
	catch (...) {

		LOG_FATAL_ERROR("Unhandled Exception.");
	}

	GameServer::kill();

	return (0);
}
